package cn.ylhx.venue.common.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.ylhx.venue.common.web.JsonResult;
import cn.ylhx.venue.system.entity.User;
import cn.ylhx.venue.system.service.UserService;


@Controller
public class IndexController {
	
	@Resource
	private UserService userService;
	
	@RequestMapping("indexUI.do")
	public String indexUI(){
		return "index";
	}
	/**
	 * 获取用户可以加载的菜单列表
	 */
	@RequestMapping("menuList")
	@ResponseBody
	public JsonResult menuList(){
		List<Map<String, Object>> list = userService.menuList();
		System.out.println(list);
		User user = (User) SecurityUtils.getSubject().getSession().getAttribute("currentUser");
		String username=user.getUsername();
		return new JsonResult(list);
	}

}
